var WxParse = require('../../component/wxParse/wxParse.js'); //html转小程序代码
Page({

  /**
   * 页面的初始数据
   */
  data: {
    jine:0,
    total:'',
    cz_yue:'',
    remark_s:'',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.request({
      url: 'https://wukongweixiu.cn/index/Defaults/getyue',
      data: {
        id: getApp().globalData.id,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      method: 'GET',
      success: function (res) {
       
        var remark_s = res.data.data.remark_s;
        console.log(remark_s)
        that.setData({
          total: res.data.data.yue,
          cz_yue: res.data.data.cz_yue,
          remark_s: WxParse.wxParse('remark_s', 'html', remark_s, that, 5)
        })
      }
    })
  },
  change: function (e) {
    var that = this;
    that.setData({
      jine: e.detail.value
    })
  },
  tixian:function(){
    var that = this;
    var money =that.data.jine;
    var re = /^[0-9]+.?[0-9]*$/;
    if (!re.test(money) || money <= 0){
      wx.showToast({
        title: "请填写正确的金额!",
        icon: 'success',
        duration: 3000,
      });
      return false;
    }
    wx.request({
      url: 'https://wukongweixiu.cn/index/Defaults/totixian',
      data: {
        userid: getApp().globalData.id,
        money: money,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      method: 'GET',
      success: function (res) {
        
       if(res.data.code == 1){
         console.log(res);
         wx.switchTab({
           url: '../ours/ours',
         })
       }
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})